<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>选择产品挂靠公司列表</title>
	<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div class="searchArea">
		<form id="searchBar">
			<div class="fieldset1 clearFix">
				<div class="fieldBox">
					<div class="label">挂靠公司名称</div>
					<div class="field">
						<input name="lnkCompNm" id="lnkCompNm" type="text"
							   class="ui-textbox" value="">
					</div>
				</div>
				<div class="fieldBox">
					<div class="label">姓名</div>
					<div class="field">
						<input name="rlNm" id="rlNm" type="text"
							   class="ui-textbox" value="">
					</div>
				</div>
				<div class="fieldBox">
					<div class="label">证件号</div>
					<div class="field">
						<input name="certNo" id="certNo" type="text"
							   class="ui-textbox" value="">
					</div>
				</div>
				<div class="fieldBox">
					<div class="label">手机号</div>
					<div class="field">
						<input name="rlTel" id="rlTel" type="text"
							   class="ui-textbox" value="">
					</div>
				</div>
				<div class="formBtns notRight">
					<span id="searchBtn" class="sq-button-round">查询</span>
					<span id="clearBtn" onclick="clearBtn();" class="sq-button-round">清空</span>
				</div>
			</div>
		</form>

	</div>
	<div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
	var grid = null;
	var prjTypCd = '${prjTypCd}';
	var prjId = '${prjId}';
	var vehNo = '${vehNo}';
	var splId = '${splId}';
	if (StringUtils.isEmpty(${splId})){
		splId = "";
	}
	var audStsCdList = new Array();
	audStsCdList.push(CommonConstant.C_AUD_PASS_CODE);
	audStsCdList.push(CommonConstant.C_AUD_ADNWAY_CODE);
	audStsCdList.push(CommonConstant.C_AUD_CHANGEADNWAY_CODE);
	audStsCdList.push(CommonConstant.C_AUD_REJECT_CODE);
	var audStsCdListArr = JSON.stringify(audStsCdList);
	$(function () {
		urlAdr = '<%=path%>/project/prjlnkcomp/initPreList.do?audStsCdList='+audStsCdListArr+'&isQueryExpDt=0'+'&isBlackList=0'+'&prjId='+ prjId +'&vehNo='+ vehNo +'&prjTypCd='+ prjTypCd +'&splId='+ splId ;
		$("#ligergrid1").ligerGrid({
			url: urlAdr,
			method : 'get',
			columns: [
				{ display: '公司名称', name: 'lnkCompNm', minWidth: 60,
					render: function (rowdata, rowindex, value){
						var h='';
						if(rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_NON||rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_IN){
							h+='<i class="ico_flasher"></i>';
						}
						h+=rowdata.lnkCompNm;
						return h;
					}},
				{ display: '公司星级', name: 'starLevelNm', minWidth: 60},
				{ display: '成立日期', name: 'regDt', minWidth: 140 , render:renderDate,enabledSort:true},
				{ display: '企业类型', name: 'compTyp', minWidth: 60},
				{ display: '法人代表', name: 'corpRep', minWidth: 140 },
				{ display: '联系人', name: 'lnkNm', minWidth: 140 },
				{ display: '是否黑名单', name: 'isBlackList', minWidth: 140 ,render:function(rowdata){
						if(rowdata.isBlackList=='1'){
							return "黑名单";
						}
					}},
				{
					display: '操作',
					isSort: false,
					width: 100,
					render: function (rowdata, rowindex, value){
						var h='<a class="sq-button-hasicon" href="javascript:chooseLnkComp(';
						h+="'"+rowdata.id+"',";
						h+="'"+rowdata.lnkCompNm+"',";
						h+="'"+rowdata.starLevelNm+"',";
						h+="'"+rowdata.rcCstBscInfoId+"'";
						h+=')"><i class="sqBtnIco_3"></i>选择</a>'
						return h;
					}
				}
			],
			pageSize:10,
			root:'rows',
			record:'total',
			hideLoadButton : true,
			width: '100%',
			height:'100%',
			heightDiff:-2,
			checkbox:true,
			rownumbers:true
		});
		grid = liger.get("ligergrid1");
		grid.setHeight(100);
		$("#searchBar").ligerForm();
		//查询
		$("#searchBtn").click(function(event) {
			var form = new liger.get("searchBar");
			var data = form.getData();
			data["lnkCompNm"] = $("#lnkCompNm").val();
			data["audStsCd"] = $("#audStsCd").val();

			data["rlNm"] = $("#rlNm").val();
			data["certNo"] = $("#certNo").val();
			data["rlTel"] = $("#rlTel").val();
			for (name in data){
				grid.setParm(name,data[name]);
			};
			grid.reload();
		});
	});

	//格式化时间
	function renderDate(rowdata, index, value) {
		var dateStr = "";
		if (null != value) {
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	//选择
	function chooseLnkComp(lnkCompId,lnkCompNm,starLevelNm,rcCstBscInfoId){
		if(lnkCompId){
			var combo_DATA = {"id":lnkCompId,"name":lnkCompNm,"star":starLevelNm,"rcCstBscInfoId":rcCstBscInfoId};
			if(frameElement && frameElement.dialog) {
				frameElement.dialog.set("_lnk", combo_DATA); //给父窗口的dialog传参
				frameElement.dialog.close();
			}
		}
	}
	//清空
	function clearBtn() {
		var form = new liger.get("searchBar");
		form.setData({
			lnkCompNm : " "
		});
	}
</script>

</body>
</html>